<?php
include_once('include/bittorrent.php');
loggedinorreturn();
gzip();
header('Content-Type: text/html; charset=Windows-1251');

echo '<div id="wol" style="width:100px;">';
if ( cache_check('whoonline') ) {
	echo cache_read('whoonline');
} else {
	$dt = sqlesc(time() - 30);
	$res = mysql_query('SELECT uid, username, class FROM sessions WHERE time >= '.$dt.' AND uid > 0 AND url = "online.php" OR url = "shoutbox.php" ORDER by class DESC,username ') or print(mysql_error());
	$data='';
	while ($arr = mysql_fetch_assoc($res)) {
		$data.='<span onclick="parent.document.shoutform.shout.focus();parent.document.shoutform.shout.value=\'privat('.$arr['username'].') \'+parent.document.shoutform.shout.value;return false;" style="cursor: pointer; color: red; font-weight: bold;">P</span> <b><a class=user href="userdetails.php?id='.$arr['uid'].'" onClick="parent.document.shoutform.shout.focus();parent.document.shoutform.shout.value=\'[b]'.$arr['username'].'[/b] \'+parent.document.shoutform.shout.value;return false;">'.get_user_class_color($arr['class'], $arr['username']) .'</a></b></span><br />';
	}
	cache_write('whoonline',$data,3);
	echo $data;
}
echo '</div>';
?>
